#include<stdio.h>

void QuickSort(int* arr,int left,int right)
{
	if(left<right)
	{
		int low=left,high=right;
		int benchmark=arr[low];
		while(high>low)
		{
			while(arr[high]>=benchmark&&high>low)
				high--;
			arr[low]=arr[high];
			while(arr[low]<=benchmark&&high>low)
				low++;
			arr[high]=arr[low];
		}
		arr[low]=benchmark;
		QuickSort(arr,left,low-1);
		QuickSort(arr,low+1,right);
	}
}

int main()
{
	int arr[10]={3,5,1,7,2,6,8,4,9,0};
	int i=0;
	QuickSort(arr,0,9);
	for(i=0;i<10;i++)
		printf("%d ",arr[i]);
	return 0;
}
